package poc.echo;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.springframework.stereotype.Component;
import org.springframework.webflow.core.collection.LocalParameterMap;

@Component
public class EchoService {

    public void echo() {
	System.out.println("[Echo...................................]");
    }

    public void echoObject(Object o) {
	System.out.println(ToStringBuilder.reflectionToString(o));
    }

    public void changeAge(User u, LocalParameterMap request) {
	// System.out.println(context.getRequestParameters().asMap());
	System.out.println("Changed Age:" + u.getAge());
	System.out.println(request);
    }

    public User initialUser(User u) {
	u.setFirstName("shawn");
	u.setLastName("Guo");
	u.setEmail("xguo@hp.com");
	u.setAge(26);
	u.setStatus(false);
	return u;
    }

    public List<User> getUserList() {

	User u1 = new User();
	u1.setFirstName("shawn");
	u1.setEmail("guoxu1231@gmail.com");
	// u1.setBirthday(new Date());
	u1.setAge(25);

	User u2 = new User();
	u2.setFirstName("linda");
	u2.setEmail("linda@gmail.com");
	u2.setAge(30);

	User u3 = new User();
	u3.setFirstName("yuki");
	u3.setEmail("bagyourei2007@163.com");
	u3.setAge(43);

	List<User> l = new ArrayList<User>();
	l.add(u1);
	l.add(u2);
	l.add(u3);
	System.out.println("get user list...................size:" + l.size());

	return l;

    }

}
